import { defineStore } from "pinia";

export const useApiResponseCodeStore = defineStore('apiResponseCode', () => {
    //api响应码枚举
    const apiResponseCode = createEnum([
        ['Success', '000000']
    ]);

    return { apiResponseCode }
})

// 枚举实现方案
function createEnum(values) {
    const enumObject = {};
    const reverseMapping = {};

    values.forEach(([key, value]) => {
        enumObject[key] = value;
        reverseMapping[value] = key;
    });

    // 冻结对象防止修改
    return Object.freeze(enumObject);
}